package vn.ducquoc.cxf;

import java.util.Arrays;
import java.util.List;

/**
 * Service class, to process logic instead of REST or DAO layer.
 * 
 * @author ducquoc
 */
public class TodoManager {

  public List<TodoItem> findAll() {
    TodoItem item = new TodoItem();
    item.setId(99L);
    item.setImportantLevel("IMPORTANT");
    item.setNote("borrow some $$$ to survive this winter");

    TodoItem item2 = new TodoItem();
    item2.setId(101L);
    item2.setImportantLevel("LATER");
    item2.setNote("buy new tennis racket (Wilson rocks & Babolat sucks)");

    return Arrays.asList(item, item2);
  }

  public TodoItem findById(Long id) {
    TodoItem item = new TodoItem();
    item.setId(id);
    item.setImportantLevel("IMPORTANT");
    item.setNote("borrow some $$$ to survive this winter");

    return item;
  }

  public void save(TodoItem request) {
    TodoItem item = new TodoItem();
    item.setId(request.getId());
    item.setImportantLevel(request.getImportantLevel());
    item.setNote(request.getNote());
  }

  public void remove(Long id) {
    TodoItem item = new TodoItem();
    item.setId(id);
    item.setImportantLevel("IMPORTANT");
    item.setNote("borrow some $$$ to survive this winter");
  }

}
